<template>
  <div>
    <div style="padding: 5px 10px">
      <el-row>
        <el-col :span="12">
          <h3 style="width: 200px;">规划基本信息:</h3>
        </el-col>
        <el-col :span="12">
          <h5 style="float: right;margin-bottom: 0px;font-size: 14px;">规划编码:{{detaildata.pmuc}}</h5>
        </el-col>
      </el-row>
      <table class="bs-table">
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">规划名称</th>
          <td class="bs-table_td" colspan="3">
            <el-link style="font-weight: bold;font-size: 20px" href="javascript:;" target="_blank">{{detaildata.title}}</el-link>
            <span style="vertical-align: bottom" v-if="detaildata.releaseNo">【{{detaildata.releaseNo}}】</span>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">规划类型</th>
          <td class="bs-table_td">{{BASICINFO.category[detaildata.category]}}</td>
          <th class="bs-table_th" style="width: 200px">规划期限</th>
          <td class="bs-table_td">{{detaildata.startDate}}至{{detaildata.endDate}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">申报(牵头)单位</th>
          <td class="bs-table_td">{{detaildata.orgName}}</td>
          <th class="bs-table_th">规划等级</th>
          <td class="bs-table_td">{{BASICINFO.planningRank[detaildata.planningRank]}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">发布时间</th>
          <td class="bs-table_td">{{detaildata.releaseDate}}</td>
          <th class="bs-table_th">发布层级</th>
          <td class="bs-table_td">{{BASICINFO.planningLevel[detaildata.planningLevel]}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">审批机关级别</th>
          <td class="bs-table_td">{{BASICINFO.approvingAuthorityLevel[detaildata.approvingAuthorityLevel]}}</td>
          <th class="bs-table_th">审批机关性质</th>
          <td class="bs-table_td">{{BASICINFO.approvingAuthorityNature[detaildata.approvingAuthorityNature]}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">联系人姓名</th>
          <td class="bs-table_td">{{detaildata.contactName}}</td>
          <th class="bs-table_th">联系电话</th>
          <td class="bs-table_td">{{detaildata.contactNumber}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">编制经费来源</th>
          <td class="bs-table_td" colspan="3">
            {{detaildata.financialSource}}
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">立项依据</th>
          <td class="bs-table_td" colspan="3">
            <span v-html="detaildata.basis"></span>
            <span v-if="detaildata.basisFileId">
              <preview :attachementId="Number(detaildata.basisFileId)" v-if="detaildata.basisFileId"></preview>
            </span>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">主要内容</th>
          <td class="bs-table_td" colspan="3" v-html="detaildata.content">
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">规划文本</th>
          <td class="bs-table_td" colspan="3">
            <preview :attachementId="Number(detaildata.textId)" v-if="detaildata.textId"></preview>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">相关材料</th>
          <td class="bs-table_td" colspan="3">
            <div v-for="(fileid,index) in detaildata.relatedFileIds" :key="index">
              <preview :attachementId="Number(fileid)" v-if="fileid"></preview>
            </div>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">编制说明</th>
          <td class="bs-table_td" colspan="3">
            <preview :attachementId="Number(detaildata.instruction)" v-if="detaildata.instruction"></preview>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">衔接意见</th>
          <td class="bs-table_td" colspan="3">
            <preview :attachementId="Number(detaildata.connectOpinion)" v-if="detaildata.connectOpinion"></preview>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">专家评审意见</th>
          <td class="bs-table_td" colspan="3">
            <preview :attachementId="Number(detaildata.expertOpinion)" v-if="detaildata.expertOpinion"></preview>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">报送文件</th>
          <td class="bs-table_td" colspan="3" v-if='detaildata.reportFileIdsStr'>
            <preview v-for='item in detaildata.reportFileIdsStr.split(",")' :attachementId="Number(item)" v-if="item"></preview>
          </td>
          <td class="bs-table_td" colspan="3" v-else></td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">其他文件</th>
          <td class="bs-table_td" colspan="3" v-if='detaildata.otherFileIdsStr'>
            <preview v-for='item in detaildata.otherFileIdsStr.split(",")' :attachementId="Number(item)" v-if="item"></preview>
          </td>
          <td class="bs-table_td" colspan="3" v-else></td>
        </tr>
        
        <tr class="bs-table_row">
          <th class="bs-table_th">是否公开</th>
          <td class="bs-table_td" colspan="3">{{BASICINFO.isOpen[detaildata.isOpen]}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">规划文本(部分公开)</th>
          <td class="bs-table_td" colspan="3">
            <preview :attachementId="Number(detaildata.halfOpenTextId)" v-if="detaildata.halfOpenTextId"></preview>
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
  import preview from "@/components/file/preview"
  import {getAchievementDetail} from "@/api/achievement";
  import {BASICINFO} from "@/const/planning";

  export default {
    name: "achievementDetail",
    props: {
      id: Number
    },
    components: {preview},
    created() {
      this.getAchievementDetailData();
    },
    computed: {},
    data() {
      return {
        detaildata: {
          relatedFileIds:[],
        },
        BASICINFO: BASICINFO

      }
    },
    methods: {
      getAchievementDetailData() {
        getAchievementDetail(this.id).then(response => {
          if (response.data.code == 0) {
            this.detaildata = response.data.data;
            if(response.data.data.fileId!=''&&response.data.data.fileId!=null){
              this.detaildata.relatedFileIds = response.data.data.fileId.split(',');
//              for (var item in this.detaildata.relatedFileIds){
//                this.detaildata.relatedFileIds[item] = this.detaildata.relatedFileIds[item].toInteger();
//              }
            }
          }
        });
      }
    }
  }
</script>

<style ang="scss" scoped>

</style>
